﻿//=====================================================
// Copyright © 2017-2018 xuxuzhaozhao
// All rights reserved
// GUID: 40b020e4-d17b-4ba4-b28c-8462fcb908e0
// CLR版本: 4.0.30319.42000
// 命名空间名称: xuxuzhaozhao.Blog.Exception
// 文件名: XuException
// 当前系统时间: 2017/11/8 10:55:28
// 当前登录用户名: xuxuzhaozhao
//======================================================

using Newtonsoft.Json;
using xuxuzhaozhao.Blog.Infrastructure.XuTools;

namespace xuxuzhaozhao.Blog.XuException
{
    public class XuException : System.Exception
    {
        public XuResult XuResult { get; set; }
        public XuException(string message = "发现异常", StatusCode code = StatusCode.Fail, object data = null)
        {
            XuResult = new XuResult();
            XuResult.Message = message;
            XuResult.Code = code;
            XuResult.Data = data;
        }

        public override string Message => JsonConvert.SerializeObject(XuResult);
    }
}